<?php
 include "counter2.php";

pagestart();
?>
<html>
<?php pagehead(_("ADM: Active maintainers"));
?>
<BODY bgcolor="white">
<?php pagetop(_("ADM: Active maintainers")) ?>

<!-- Main content goes here -->
<?php
$orderby = $counter->get_input("orderby", "alphanum", "get");
$desc =  $counter->get_input("desc", "alphanum", "get");
if (!($orderby)) $orderby = "logintime";
if (!($desc)) $desc="asc";

$maintainers = mysql_query("select users.f_key, login, persons.name, users.state, logintime from users left join persons on users.f_key = persons.f_key where login <> '' order by $orderby $desc");
if (!$maintainers) {
  die("Query failed: " . mysql_error());
}

$url = preg_replace("/\?.*/", "", $self_url);

print "<table>";
print "<tr>";
print "<th align=\"left\"><a href=\"$url?orderby=login\">" . _("Login") . "</a>";
print "<th align=\"left\"><a href=\"$url?orderby=name\">" . _("Name") . "</a>";
if ($desc == "asc") {
  print "<th><a href=\"$url?orderby=logintime&amp;desc=desc\">" . _("Last login") . "</a>";
} else {
  print "<th><a href=\"$url?orderby=logintime&amp;desc=asc\">" . _("Last login") . "</a>";
}

while ($m = mysql_fetch_array($maintainers)) {
  print "<tr><td>";
  if ($m['login'] == $REMOTE_USER) {
    print "<b>" .  $m['login'] . "</b>";
  } else {
    print $m['login'];
  }
  print "<td>";
  if ($m['state'] == 'frozen') {
    print "---" . _("frozen") . "---";
  } else {
    print person_url($m['f_key'], $m['name']);
  }
  print "<td>" . $m['logintime'] . "</tr>\n";
}
print "</table>";
?>

<?php pagebottom() ?>
</body>
</html>

